package spring.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
@RequestMapping("/post/qs")
public class PostQuerystringController {
    // curl -i --data "email=a@b.com&password=pwd&deviceId=did" localhost:8080/post/qs
    @RequestMapping(method = RequestMethod.POST)
    @ResponseBody
    public String authority(HttpServletRequest req, HttpServletResponse res) throws IOException {
        System.out.println("AuthController");
        //
        String email = req.getParameter("email");
        String password = req.getParameter("password");
        String deviceId = req.getParameter("deviceId");

        System.out.println("email = " + email);
        System.out.println("password = " + password);
        System.out.println("deviceId = " + deviceId);

        return "abc";
    }
}
